# coding:utf-8
# 王一舟
# demo_4_DeepSearch.py
from deepdiff import DeepSearch


# obj = ["adsakjfs",0,"但考虑到分手快乐电风","python", {"data": "666"}]
#
# item = "111"
#
# print(DeepSearch(obj, item,))



def assert_DeepDiff_search(**kwargs):
    '''
    对比2个数据的差异
    :param obj:搜素的范围数据
    :param item:要搜索的内容
    :param 大小写敏感: case_sensitive=True, 默认Flase 不敏感
    '''

    obj = kwargs["obj"]
    item = kwargs["item"]
    case_sensitive = kwargs.get("大小写敏感",False)
    filter = {"case_sensitive":case_sensitive}
    search_data  = DeepSearch(obj,item,**filter)

    if search_data:
        print(search_data)
    else:
        raise AssertionError(f"未找到{item}")

if __name__ == '__main__':


    data = {"obj":{'msg': '登录成功', 'code': 0, 'data': {'id': '75', 'username': 'hami', 'nickname': '哈米老师'}},"item":"hami","大小写敏感":True}



    assert_DeepDiff_search(**data)

